<template>
    <div>
        <el-menu mode="horizontal"
                 @select="handleSelect"
                 :default-active="activeIndex">
            <el-menu-item index="">
                <el-input placeholder="Search"></el-input>
            </el-menu-item>
            <el-submenu index="settings">
                <template slot="title">Personal</template>
                <el-menu-item index="resetpwd">Reset Password</el-menu-item>
                <el-menu-item index="login">Logout</el-menu-item>
            </el-submenu>
        </el-menu>
        <reset-pwd ref="dialogPwd"></reset-pwd>
    </div>
</template>
<script>
    import ResetPwd from '@/components/resetPwd.vue'
    export default {
        components: { ResetPwd },
        data () {
            return {
                activeIndex: '0'
            }
        },
        methods: {
            handleSelect (key, keyPath) {
                console.log('key', key)
                console.log('keypath', keyPath)
                switch (key) {
                    case 'resetpwd':
                        this.$refs.dialogPwd.dialogVisible = true
                        break;
                    case 'login':
                        this.$router.push('/login')
                        break;
                }
            },
            resetpwd () {
                console.log('123')
            }
        }
    }
</script>
